#include <opencv2/opencv.hpp>
#include<iostream>
#include<stdio.h>

using namespace std;
using namespace cv;
int main(){
    string video_path = "/home/ljb/dataset/yolop/gta.mp4";
    VideoCapture cap(video_path);
    if (!cap.isOpened()){
        cout <<"can not open file:" << video_path<<endl;
        return -1;
    }
    int n_f = cap.get(CAP_PROP_FRAME_COUNT);
    double fps = cap.get(CAP_PROP_FPS);
    int delay = int(1000/fps);
    while (true)
    {
        Mat frame;
        bool success = cap.read(frame);
        if (!success){
            printf("can not read frames\n");
            break;
        }
        imshow("frame",frame);
        if (waitKey(delay)==27)
            break;
    }
    cap.release();
    destroyAllWindows();
    return 0;
    
}